<meta charset="UTF-8">

<?php
include_once("functions/db_manipulate.php");
if (!init()) {
    redirect('login.php');
}

$link_id = connectDB();

startTransaction();

$resultSet = mysql_query("DELETE
                          FROM dialogs
                          WHERE
                                   id = '" . mysql_real_escape_string($_GET['did']) . "'
                               AND
                                   (getteruserid = '" . $_SESSION['id'] . "'
                               OR
                                    senderuserid = '" . $_SESSION['id'] . "')");

if ($resultSet) {
    commitTransaction();
} else {
    rollbackTransaction();
}

redirect($_SERVER['HTTP_REFERER']);


?>